﻿// ===============================================================================
//  Copyright © ymind.net. All rights reserved .
//  官方网站：http://ymind.net/
//  版权所有：彦铭工作室 老陈出品
// ===============================================================================

using System.Collections;
using System.Collections.Generic;

namespace Lcsoft.RssEngine.Collections
{
	/// <summary>A strongly typed collection of <see cref="RssModuleItem"/> objects</summary>
	public class RssModuleItemCollection : List<RssModuleItem>
	{
		private readonly ArrayList _alBindTo = new ArrayList();

		/// <summary>Bind a particular item to this module</summary>
		/// <param name="itemHashCode">Hash code of the item</param>
		public void BindTo(int itemHashCode) { this._alBindTo.Add(itemHashCode); }

		/// <summary>Check if a particular item is bound to this module</summary>
		/// <param name="itemHashCode">Hash code of the item</param>
		/// <returns>true if this item is bound to this module, otherwise false</returns>
		public bool IsBoundTo(int itemHashCode) { return (this._alBindTo.BinarySearch(0, this._alBindTo.Count, itemHashCode, null) >= 0); }
	}
}
